package com.lg.distributed.idempotence.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author by Mr. Li 2020/12/10 18:33
 */
@RestControllerAdvice
public class GlobalExceptionController {
    @ExceptionHandler(value = Exception.class)
    public String exceptionHandler(Exception e) {

        if (e instanceof GlobalException) {
            return ((GlobalException) e).getMsg();
        }

        return "系统位置异常，请稍后重试- -";
    }
}
